home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / bash_114.zip / bash-1.14.2 / unwind_prot.h < prev    next >
Text File  |  1994-05-24  |  2KB  |  48 lines

  1. /* unwind_prot.h - Macros and functions for hacking unwind protection. */
  2.  
  3. /* Copyright (C) 1993 Free Software Foundation, Inc.
  4.  
  5.    This file is part of GNU Bash, the Bourne Again SHell.
  6.  
  7.    Bash is free software; you can redistribute it and/or modify it under
  8.    the terms of the GNU General Public License as published by the Free
  9.    Software Foundation; either version 2, or (at your option) any later
  10.    version.
  11.  
  12.    Bash is distributed in the hope that it will be useful, but WITHOUT ANY
  13.    WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14.    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15.    for more details.
  16.  
  17.    You should have received a copy of the GNU General Public License along
  18.    with Bash; see the file COPYING.  If not, write to the Free Software
  19.    Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
  20.  
  21. #if !defined (_UNWIND_PROT_H)
  22. #define _UNWIND_PROT_H
  23.  
  24. /* Run a function without interrupts. */
  25. void
  26.   begin_unwind_frame (), discard_unwind_frame (),
  27.   run_unwind_frame (), add_unwind_protect (), remove_unwind_protect (),
  28.   run_unwind_protects ();
  29.  
  30. /* Define for people who like their code to look a certain way. */
  31. #define end_unwind_frame()
  32.  
  33. /* How to protect an integer. */
  34. #define unwind_protect_int(X) unwind_protect_var (&(X), (char *)(X), sizeof (int))
  35.  
  36. /* How to protect a pointer to a string. */
  37. #define unwind_protect_string(X) \
  38.   unwind_protect_var ((int *)&(X), (X), sizeof (char *))
  39.  
  40. /* How to protect any old pointer. */
  41. #define unwind_protect_pointer(X) unwind_protect_string (X)
  42.  
  43. /* How to protect the contents of a jmp_buf. */
  44. #define unwind_protect_jmp_buf(X) \
  45.   unwind_protect_var ((int *)(X), (char *)(X), sizeof (jmp_buf))
  46.  
  47. #endif /* _UNWIND_PROT_H */
  48.